  We present a new theoretical modeling to predict luminosity and spectrum of
gamma-ray and neutrino emission of a star-forming galaxy, from star formation
rate ($\psi$), gas mass ($M_{\rm gas}$), stellar mass, and disk size, taking
into account production, propagation and interactions of cosmic rays. The model
reproduces the observed gamma-ray luminosities of nearby galaxies detected by
{\it Fermi} better than the simple power-law models as a function of $\psi$ or
$\psi M_{\rm gas}$. Then this model is used to predict the cosmic background
flux of gamma-ray and neutrinos from star-forming galaxies, by using a
semi-analytical model of cosmological galaxy formation that reproduces many
observed quantities of local and high-redshift galaxies. Calibration of the
model using gamma-ray luminosities of nearby galaxies allows us to make a more
reliable prediction than previous studies. In our baseline model star-forming
galaxies produce about 20% of isotropic gamma-ray background unresolved by {\it
Fermi}, and only 0.5% of IceCube neutrinos. Even with an extreme model assuming
a hard injection cosmic-ray spectral index of 2.0 for all galaxies, at most 22%
of IceCube neutrinos can be accounted for. These results indicate that it is
difficult to explain most of IceCube neutrinos by star-forming galaxies,
without violating the gamma-ray constraints from nearby galaxies.
